package com.market.mapper;

import com.github.pagehelper.Page;
import com.market.Dto.ProductQueryDto;
import com.market.entity.Product;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ProductMapper {
    /**
     * 分页查询
     * @param productQueryDto
     * @return
     */
    Page<Product> pageQuery(ProductQueryDto productQueryDto);

    /**
     * 添加商品
     * @param product
     */
    void saveProduct(Product product);

    /**
     * product
     * @param id
     * @return
     */
    @Select("select * from pruduct where id=#{id}")
    Product getById(Long id);

    /**
     * 修改商品
     * @param product
     */
    void update(Product product);

    /**
     * 删除商品
     * @param id
     */
    @Delete("delete from pruduct where id=#{id}")
    void deleteById(Long id);
}
